package com.csweimei.rentmanagementtreasure.tenant.viewModel;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.http.entity.LeaseListBean;
import com.csweimei.rentmanagementtreasure.tenant.ui.act.LeaseDetailActivity;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class LeaseListItemVM extends MultiItemViewModel {
    public LeaseListItemVM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
    }

    public ObservableField<LeaseListBean.DataDTO> entity =new ObservableField<>();

    public void setData(LeaseListBean.DataDTO dataDTO) {
        entity.set(dataDTO);
    }

    public BindingCommand hzEdit = new BindingCommand(new BindingAction() {
        @Override
        public void call() {

        }
    });

    public BindingCommand delZz = new BindingCommand(new BindingAction() {
        @Override
        public void call() {

        }
    });

    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putInt("id",entity.get().getId());
            viewModel.startActivity(LeaseDetailActivity.class,bundle);
        }
    });
}
